//
//  UIView+Layout.swift
//  HuaYun
//
//  Created by enghou on 2018/6/27.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

import UIKit

extension UIView{
    
    var left : CGFloat{
        get{
            return self.frame.origin.x
        }
        set{
            self.frame = CGRect(origin: CGPoint(x: newValue, y: self.top), size: self.frame.size)
        }
    }
    
    var top : CGFloat{
        get{
            return self.frame.origin.y
        }
        set{
            self.frame = CGRect(origin: CGPoint(x: self.left, y: newValue), size: self.frame.size)
        }
    }
    
    var bottom : CGFloat{
        get{
            return self.top + self.height
        }
    }
    
    
    var width: CGFloat{
        get{
            return self.frame.size.width
        }
        set{
            self.frame = CGRect(origin: self.frame.origin, size: CGSize(width: newValue, height: self.height))
        }
    }
    
    var height: CGFloat{
        get{
            return self.frame.size.height
        }
        set{
            self.frame = CGRect(origin: self.frame.origin, size: CGSize(width: self.width, height: newValue))
        }
    }
    
    var size: CGSize{
        get{
            return self.frame.size
        }
        set{
            self.frame = CGRect(origin: self.origin, size: newValue)
        }
    }
    
    var origin: CGPoint{
        get{
            return self.frame.origin
        }
        set{
            self.frame = CGRect(origin: newValue, size: self.size)
        }
    }
}
